// import { h } from 'vue'
import type { RouteRecordRaw } from 'vue-router'

// function render() {
//   return h('router-view')
// }
//对外暴露配置路由(常量路由):全部用户都可以访问到的路由
export const constantRoute: RouteRecordRaw[] = [
  {
    //登录成功以后展示数据的路由
    path: '/login',
    name: 'login',
    component: () => import('@/views/login/index.vue'),
    meta: {
      title: '',
      hidden: false,
      icon: '',
    },
  },
  {
    //登录成功以后展示数据的路由
    path: '/',
    name: 'layout',
    component: () => import('@/layout/Layout.vue'),
    redirect: '/books',
    children: [
      //book管理页面
      {
        path: 'books',
        name: 'books',
        redirect: '/books/borrow',
        children: [
          {
            path: 'borrow',
            name: 'books.borrow',
            component: () => import('@/views/books/borrow.vue'),
            // redirect: '/menu/list/a',
            // children: [
            //   {
            //     path: 'a',
            //     name: 'menu.list.a',
            //     component: () => import('@/views/menu/list.vue'),
            //   }
            // ],
          },
          {
            path: 'return',
            name: 'books.return',
            component: () => import('@/views/books/return.vue'),
          },
          {
            path: 'bookManagement',
            name: 'books.bookManagement',
            component: () => import('@/views/books/bookManagement.vue'),
          },
          {
            path: 'allRecords',
            name: 'books.allRecords',
            component: () => import('@/views/books/allRecords.vue'),
          }

        ],
      },
      {
        path: 'menu',
        name: 'menu',
        redirect: '/menu/list',
        children: [
          {
            path: 'list',
            name: 'menu.list',
            component: () => import('@/views/menu/list.vue'),
            // redirect: '/menu/list/a',
            // children: [
            //   {
            //     path: 'a',
            //     name: 'menu.list.a',
            //     component: () => import('@/views/menu/list.vue'),
            //   }
            // ],
          },
          {
            path: 'form',
            name: 'menu.form',
            component: () => import('@/views/menu/form.vue'),
          }
        ],
      },
    ],
  },
]

//异步路由
export const asnycRoute: RouteRecordRaw[] = []

//任意路由
export const anyRoute: RouteRecordRaw = {
  //任意路由
  path: '/:pathMatch(.*)*',
  redirect: '/login',
  name: 'Any',
  meta: {
    title: '任意路由',
    hidden: true,
    icon: 'DataLine',
  },
}
